package cn.no7player.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import cn.no7player.model.UserModel;
import cn.no7player.service.LoginService;

@Controller
public class LoginController {
	@Autowired
	private LoginService userService;
	
	
	@RequestMapping(value = "/regedit",method=RequestMethod.GET)
	private String regedit(UserModel user ,Model model){
		if( null == user.getPassword() ||  "" == user.getPassword() ){
			user.setPassword("123456");
		}
		
		int addUser = userService.addUser(user);
		model.addAttribute("userName",user.getUserName());
		model.addAttribute("sex",user.getUserName());
		
		return "regedit";
	}
	
	
	@RequestMapping(value = "/login",method=RequestMethod.GET)
	private String login(UserModel user ){
		
		
		
		return "login";
	}
	

}
